Getting Started with PDF Viewer Control for .NET Windows Forms
|
|
Overview
|
|
The Winnovative PDF Viewer Control for .NET Windows Forms can be used in a Windows
Forms application to display a PDF document inside a form and allows the application
users to browse and print the PDF document. The viewer requires Adobe Reader to
be installed on the client computer in order to work properly.
The Winnovative PDF Viewer Control for .NET Windows Forms is delivered as a single
assembly PdfViewerWinNet.dll. The main class defined by this assembly is
the PdfViewer class.
|
|
Adding the PDF Viewer Control to the Microsoft Visual Studio Toolbox
|
|
First of all you have to add the control from PdfViewerWinNet.dll to the Visual
Studio toolbox. To do this you right click on the toolbox panel and select
'Choose Items'. You browse to the PdfViewerWinNet.dll and the PdfViewer control
should have been added in the toolbox panel. To use the control in a form of your
Windows Forms application you simply drag and drop the PdfViewer control from the
toolbox on the web page like you would do with any other server control. At this
moment you are ready to use the control and display PDF documents inside your form.
|
|
Loading a PDF File
|
|
A PDF file can loaded into the PDF Viewer control using the LoadFile() method of
the PdfViewer class. Here is a simple sample code to load the PDF file in the viewer
in Load event handler of the parent form:
|
|
1: private void MainForm_Load(object sender, EventArgs e)
2: {
3: string demoFilePath = System.IO.Path.Combine(Application.StartupPath,
"WinnovativeSoftware.pdf");
4: pdfViewer1.LicenseKey =
"WxrvvaNw5mDcoQ30mCbmRsrypMqSDHC2y4FhJojo+g+XWYQGh3F7cx6nZbdUAwgH";
5: if (System.IO.File.Exists(demoFilePath))
6: {
7: pdfViewer1.LoadFile(demoFilePath);
8: }
9: }
|
|
After you have loaded the PDF file in the viewer you can programmatically navigate
to a page of the document, print the PDF document with or without the print dialog,
set the zoom percentage, show or hide the viewer toolbar, etc. A full description
of all the viewer methods can be found in the API Reference document PdfViewerWinNet.chm.
|
|
Running the Samples
|
|
The samples are located in the Samples folder. To run the samples, open the projects
with the Microsoft Visual Studio and run them from there.
|
|
Licensing
|
|
The LicenseKey property of the PdfViewer class
should be set with the string you received after the purchase of the product.
|
|
Links
|
Winnovative PDF Viewer
for .NET Windows Forms Home Page
|